<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2278. 字母在字符串中的百分比</title>
</head>

<body>

</body>

<script>
    /**
     * @param {string} s
     * @param {character} letter
     * @return {number}
     */
    var percentageLetter = function (s, letter) {
        if (1 <= s.length <= 100) {
            let num = s.split('').
                filter(item => item.toLowerCase() === letter.toLowerCase()).length
            let count = Math.floor(num / s.length * 100);
            return count
        } else {
            return 0;
        }
    };
</script>

</html>